home *** CD-ROM | disk | FTP | other *** search
File List | 1995-11-01 | 840 b | 35 lines |
-
-
- /*-----------------------------------------------------*
- * curses_tst.c - C. Adamo 3/3/92
- * Demonstrate single-character input mode using curses
- *-----------------------------------------------------*/
- #include <stdio.h>
- #include <ctype.h>
- #include <curses.h>
-
- #define QUIT_CHAR 'q'
-
- void main(int argc, char *argv[])
- {
- int key = '\0';
-
- initscr(); /* initialize screen */
- cbreak(); /* enable single char mode */
- noecho(); /* disable echo mode */
-
- while (key != QUIT_CHAR)
- {
- key = getch();
- if (isalpha(key))
- {
- printf("%c\n",
- islower(key) ? toupper(key)
- : tolower(key));
- }
- }
- endwin(); /* end window modes */
-
- } /* end main() */
-
-